package com.example.app.pages.main.home.addNew.addRecord

import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.FlowRow
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import com.example.app.addRecordViewModel
import com.example.app.components.MyListItem.MyListItem
import com.example.app.data.bean.AccountTitle
import com.example.app.pages.main.home.addNew.addRecord.viewModel.AddRecordViewModel
import com.example.app.pages.main.home.me.viewModel.AccountType

//图标列表
@OptIn(ExperimentalLayoutApi::class)
@Composable
fun IncomeIconsList() {
    var titles = addRecordViewModel.allTitles.collectAsState()
    var cats = addRecordViewModel.allCats.collectAsState()
    MyListItem(
        headlineContent = {
            FlowRow {
                titles.value?.filter { accountTitle ->
                    return@filter accountTitle.AccountType == AccountType.INCOME.type
                }
                    ?.slice(0..7)
                    ?.forEach { accountTitle: AccountTitle ->
                        IncomeTitle(accountTitle = accountTitle)
                    }
                IconAll()
            }
        },
        hasWrap = true,
        myListItemWrapColumnBackgroundColor = MaterialTheme.colorScheme.surface
    )
}